package 校招笔试.美团笔试.美23901; /**
 * @author aodre , QQ : 480029069
 * @date 2023/8/26 8:41
 */

import java.util.PriorityQueue;
import java.util.Scanner;

public class Main {

    Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().solve3();
    }




    public void solve3(){
        int n = sc.nextInt();

        int nums []= new int[n];
        nums[0] = sc.nextInt();
        int x = nums[0];
        PriorityQueue<Integer> queue = new PriorityQueue<>((a,b) -> b - a);
        for (int i = 1; i < n; i++) {
            nums[i] = sc.nextInt();
            if(nums[i] > x){
                queue.add(nums[i]);
            }
        }
        if(n == 1 || queue.size() == 0){
            System.out.println(0);
            return ;
        }
        int ans = 0;
        while(x < queue.peek()){
            x *= 2;
            ans++;
        }
        System.out.println(ans);

    }







    public void solve4(){
        int n = sc.nextInt(), k = sc.nextInt();
        int rest = n - k;
        int nums[] = new int[n];
        for (int i = 0; i < n ; i++) {
            nums[i] = sc.nextInt();
        }

//        Integer dp[][] = new Integer[n + 1][rest + 1];
//        for(int i = 0;i < n;i++){
//            dp[i][1] = 1;
//        }
//        int res = 0;
//        for(int index = n - 1;index >= 0;index--){
//            for(int re = 2; re <= rest;re++){
//                long ans = 0;
//                for(int i = index + 1;i < nums.length;i++){
//                    if(nums[index] % nums[i] == 0 || nums[i] % nums[index] == 0){
//                        ans += dp[i][re - 1];
//                    }
//                }
//                ans = ans % 1000000007;
//                dp[index][re] = (int)ans;
//                res += dp[index][rest];
//            }
//        }
        long ans = 0;
        Integer dp[][] = new Integer[n + 1][rest + 1];
        for(int i = 0;i < n;i++){
            ans += recursion(i,rest - 1,nums,dp);
        }
//        int ans = recursion(0,rest,nums,new Integer[n + 1][rest + 1]);
//        System.out.println(dp[0][rest]);
        System.out.println(ans % 1000000007);

    }

    public int recursion(int index,int rest,int nums[],Integer[][]dp){
        if(rest == 0){
            return 1;
        }
        if(index == nums.length){
            return 0;
        }
        if(dp[index][rest] != null){
            return dp[index][rest];
        }
        long ans = 0;
        for(int i = index + 1;i < nums.length;i++){
            if(nums[index] % nums[i] == 0 || nums[i] % nums[index] == 0){
                ans += recursion(i,rest - 1,nums,dp);
            }
        }
        ans = ans % 1000000007;
        return dp[index][rest] = (int)ans;
    }

    public void solve2(){
        int n = sc.nextInt() , m = sc.nextInt();
        sc.nextLine();
        String ss[] = new String[n];
        for (int i = 0; i < n; i++) {
            ss[i] = sc.nextLine();
        }
        StringBuilder sb = new StringBuilder();
        int index = 0;
        String t = "meituan";
        int tIndex = 0;
        while(index < n && tIndex < 7){
            if(ss[index].contains(t.charAt(tIndex) + "")){
                tIndex++;
            }
            index++;
        }
        if(tIndex == 7){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }

    }








    public void solve1(){
        int n = sc.nextInt();
        int nums[] = new int[n];
        int b[] = new int[n - 1];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        boolean flag = true;
        for(int i = 1;i < n;i++){
            if(nums[i] < nums[i - 1]){
                flag = false;
            }
            b[i - 1] = nums[i] - nums[i - 1];
        }

        boolean flagB = true;
        if(flag){
            for (int i = 1; i < n - 1; i++) {
                if(b[i] > b[i - 1]){
                    flagB = false;
                }
            }
            if(flagB){
                System.out.println("Yes");
            }else{
                System.out.println("No");
            }

        }else{
            System.out.println("No");
        }

    }


}
